home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-17 / prbgi095.zip / DRIVERS.INC < prev    next >
Text File  |  1992-06-17  |  8KB  |  289 lines

  1.  
  2.  
  3. MaxAllModes EQU     6;  /* The maximum number of modes supported by any printer */
  4.  
  5. CR          EQU  0Dh;
  6. NL          EQU  0Ah;
  7. _Esc         EQU  01Bh;
  8. _FS          EQU  01Ch;
  9.  
  10. COMMENT \ ******************************************************************
  11.  
  12.    /* When command sending to printer is divided into two parts  */
  13.    /* it means that first Str1 is sending then needed parameter */
  14.    /* and at last Str2. Of cource Str2 may be empty one */
  15.  
  16. \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  17.  
  18. DriversNo = 0;
  19. DriverDefOnlySize = 26h;   /* without modes defined */
  20. ModeDefSize = 2Ah;
  21. ConstDriverDefSize = DriverDefOnlySize + ModeDefSize*MaxAllModes;   /* with modes defined, without strings */
  22. string_offset = ConstDriverDefSize;
  23.  
  24. ModeDefAddr = 0;
  25. DriverDefAddr = 0;
  26.  
  27. GenString  MACRO  Stype,str
  28.       ifidni <&str>,<NULL>
  29.          dw  ConstDriverDefSize
  30.          EXITM
  31.       endif
  32.       ifb   <&str>
  33.          dw  ConstDriverDefSize
  34.          EXITM
  35.       endif
  36.       o1 = $
  37.       org DriverDefAddr+string_offset
  38.       o2 = $
  39.       l  = 0
  40.       ifdifi <&Stype>,<C>
  41.          db   ?
  42.          db   str
  43.          l  = $-o2
  44.          ifidni <&Stype>,<Both>
  45.             db  0
  46.          else
  47.             ifdifi <&Stype>,<Pascal>
  48.                err Wrong string type specified
  49.             endif
  50.          endif
  51.          org  o2
  52.          db   l-1;        string length
  53.       else
  54.          ifidni <&Stype>,<C>
  55.             db   str
  56.             db   0
  57.             l  = $-o2
  58.          endif
  59.       endif
  60.       org  o1
  61.       dw    string_offset
  62.       ifidni <&Stype>,<Both>
  63.              l = l+1;
  64.       endif
  65.       string_offset = string_offset+l
  66.    ENDM
  67.  
  68. GenPString  MACRO  str
  69.             GenString  <Pascal>,<&str>
  70.             ENDM
  71.  
  72.  
  73. genstmnt    MACRO a,b,c,d,e,f,g,h
  74.             a&b   c&d   e&f&g&h
  75.             ENDM
  76.  
  77. DriverDef  MACRO
  78.            DriverDefAddr = $
  79.            org   ConstDriverDefSize
  80.            db    0;    ; NULL strings points here
  81.            org   DriverDefAddr
  82.            string_offset = ConstDriverDefSize+1;
  83.            DriversNo = DriversNo + 1;
  84.            genstmnt  <DriverDefOffs_>,%DriversNo,<=>,,<DriverDefAddr-PRT__Drivers>
  85.            ModesNo = 0
  86.            dw      ? ; place for Driver definition size
  87.            db      ? ; place for ModesNo
  88.            ENDM
  89.  
  90. EndDriverDef  MACRO
  91.               l     = $
  92.               ORG   DriverDefAddr
  93.               dw    string_offset   ; driver definition size
  94.               db    ModesNo;
  95.               org   l
  96.               l = $-DriverDefAddr
  97.               if l GT ConstDriverDefSize
  98.                  err ConstDriverDefSize === &l&
  99.                  Display "ConstDriverDefSize = &l&"
  100.               endif
  101.               ModesNo   = 0;
  102.               org   DriverDefAddr+string_offset
  103.            ENDM
  104.  
  105. PRT__RLE_COMPRESSION   EQU  1
  106. CompressionType MACRO  a
  107.                 db     a
  108.                 ENDM
  109.  
  110. DrDisp          MACRO no,str
  111.       Display "&no&. &str&"
  112.                 ENDM
  113.  
  114. DriverName      MACRO  s
  115.                 GenString <Both>,<&s>
  116.                 DrDisp    %DriversNo,<&s>
  117.                 ENDM
  118.  
  119. ASCIInumbers    MACRO p
  120.                 db    p
  121.                 ENDM
  122.  
  123. TransferValueInBytes MACRO p
  124.                      db    p
  125.                      ENDM
  126.  
  127. InitPRTStr        MACRO  s      ;  /* Init PRT string */
  128.                 GenPString <&s>
  129.                 ENDM
  130. EndPRTStr         MACRO  s      ;  /* End PRT string */
  131.                 GenPString <&s>
  132.                 ENDM
  133. CompressedStr     MACRO  s      ;  /* Compress mode string */
  134.                 GenPString  <&s>
  135.                 ENDM
  136. UncompressedStr   MACRO  s      ;  /* Compress mode string */
  137.                 GenPString <&s>
  138.                 ENDM
  139.  
  140. LeftMargin     MACRO  s1,s2,mult,div      ;
  141.                 GenPString <&s1>
  142.                 GenPString <&s2>
  143.                 dw         mult
  144.                 dw         div
  145.                 ENDM
  146.  
  147. TopMargin     MACRO  s1,s2,mult,div      ;
  148.                 GenPString <&s1>
  149.                 GenPString <&s2>
  150.                 dw         mult
  151.                 dw         div
  152.                 ENDM
  153.  
  154. ColorsStrings   Macro s1,s2,map
  155.                 GenPString <&s1>
  156.                 GenPString <&s2>
  157.                 ifb   <&map>
  158.                       dw   0
  159.                 else
  160.                       ifidni <&map>,<NULL>
  161.                              dw   0
  162.                       else
  163.                              GenCString <&map> ; we do not need null terminated string
  164.                       endif
  165.                 endif
  166.                 ENDM
  167.  
  168.  
  169. __ModeName      MACRO  s
  170.                 GenString <Both>,<&s>
  171.                 ENDM
  172.  
  173.  
  174. ModeDef   MACRO XPinch,YPinch,ColorsNo,ModeName;
  175.           ModeDefAddr  = $;
  176.           if  DriverDefOnlySize EQ 0
  177.               DriverDefOnlySize = $-DriverDefAddr
  178.           endif
  179.           if ModesNo EQ 0
  180.              if DriverDefOnlySize NE $-DriverDefAddr
  181.                 err Wrong driver definition
  182.              endif
  183.           endif
  184.           dw   XPinch,YPinch
  185.           dw   ColorsNo
  186.           ifnb <&ModeName>
  187.                __ModeName <&ModName>
  188.           else
  189.               mname  CATSTR  <'>,<&XPinch>,<x&YPinch>
  190.               if     ColorsNo GT 2
  191.                      mname  CATSTR  mname,<(&ColorsNo>,< colors)>
  192.               endif
  193.               mname  CATSTR  mname,<'>
  194.               __ModeName  <%mname>
  195.           endif
  196.           ModesNo = ModesNo+1;
  197.           ENDM
  198.  
  199. ModeOptions MACRO o1;
  200.             l  = 0;
  201.             ifidni <&o1>,<Planes>
  202.                 l  = 1;
  203.             endif
  204.             ifidni <&o1>,<SimPlanes>
  205.                 l  = 3;
  206.             endif
  207.             ifnb  <&o1>
  208.                ifdif <&o1>,<0>
  209.                   ife l
  210.                      err Wrong argument &o1& in macro ModeOptions
  211.                   endif
  212.                endif
  213.             endif
  214.             dw    l;
  215.             ENDM
  216.  
  217. ColorPalette     MACRO  palette
  218.            ifb   <&palette>
  219.                  dw   0
  220.            else
  221.               ifidni   <&palette>,<NULL>
  222.                        dw  0
  223.               else
  224.                        GenCString <&palette>
  225.               endif
  226.            endif
  227.            ENDM
  228.  
  229. InitGraphStr MACRO s;       /* init graph string  */
  230.            GenPString <&s>
  231.            ENDM
  232. EndGraphStr MACRO s;       /* end graph string  */
  233.            GenPString <&s>
  234.            ENDM
  235.  
  236. PicWidth Macro s1,s2,multiplier,divisor;  /* Def. picture width command, multiplier, divisor */
  237.          GenPString <&s1>
  238.          GenPString <&s2>
  239.          ifnb  <&multiplier>
  240.               dw multiplier
  241.          else
  242.               dw 1
  243.          endif
  244.          ifnb  <&divisor>
  245.               dw divisor
  246.          else
  247.               dw 1
  248.          endif
  249.          endm
  250.  
  251. InitTransfer MACRO s1,s2,SubValue; /* init graphic mode cmnd. */
  252.            GenPString <&s1>
  253.            GenPString <&s2>
  254.            ifb        <&SubValue>
  255.                       dw  0
  256.            else
  257.                       dw  &SubValue
  258.            endif
  259.            ENDM
  260.  
  261. PinsPerHead MACRO p;      ;/* number of pins in a head */
  262.                           ;/* 1 - for laser printers */
  263.             db     p
  264.             ENDM
  265.  
  266. PixelsStep  MACRO  p;       /* vertical density / pins distance */
  267.             db      p
  268.             ENDM
  269.  
  270. EolnStr     Macro s
  271.            GenPString <&s>
  272.            ENDM
  273.  
  274. SmallEoln  MACRO  s1,s2,mult,div
  275.                            ; /* SmallEoln multipier and dividend are the numbers */
  276.                            ; /* needed to adjust paper for one pins distance,    */
  277.                            ; /* in the case when SmallEoln command adjusts paper */
  278.                            ; /* not at vertical pixel distance but some other value */
  279.            GenPString <&s1>
  280.            GenPString <&s2>
  281.            dw        mult,div
  282.            if    ModeDefSize NE $-ModeDefAddr
  283.               err Wrong mode definition
  284.            endif
  285.            ENDM
  286.  
  287.  
  288.  
  289.